package authoritah.ui.common.renderers;

import java.awt.Component;
import java.sql.Timestamp;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.event.ChangeEvent;
import javax.swing.event.EventListenerList;
import javax.swing.table.TableCellRenderer;

import authoritah.utils.TimeUtils;


public class TimeTableCellRenderer extends JLabel implements TableCellRenderer {

	protected EventListenerList listenerList = new EventListenerList();
	protected ChangeEvent changeEvent = new ChangeEvent(this);

	public TimeTableCellRenderer() {
		super();
	}

	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		if (value instanceof Timestamp) {
			Timestamp timestamp = (Timestamp) value;
			this.setText(TimeUtils.getTimeFromTimestamp(timestamp));
			return this;
		} else {
			return new JLabel("");
		}
	}
}
